home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / Apps / ScreenSavers / BackSpaceViews / AnalogClockView.BackModule / AnalogClockWraps.psw < prev    next >
Encoding:
Text File  |  1995-06-12  |  1.7 KB  |  90 lines

  1. defineps drawHourMinuteFace(int hours; int mins; int width; int height; int hasColor)
  2.     width 2 div 12 add                    % make (0,0) the center of it
  3.     height 2 div 12 add
  4.     translate
  5.  
  6.     0.0 setgray                           % clear the background to black
  7.     -140 -140 280 280 rectfill
  8.     stroke
  9.  
  10.         1 hasColor eq                         % draw the clock face
  11.           {.333 .333 .5 setrgbcolor }
  12.           {.333 setgray } ifelse
  13.     0.0 0.0 width 2.0 div 0.0 360.0 arc
  14.     fill stroke
  15.  
  16.     1 hasColor eq                         % and the 4 hashmarks....
  17.       { .667 .333 .333 setrgbcolor }
  18.       { 1.0 setgray } ifelse
  19.     -.5 width mul 10 add
  20.     -3.0
  21.     35.0
  22.     6.0 
  23.     rectfill
  24.  
  25.     .5 width mul 10.0 sub
  26.     -3.0
  27.     -35.0
  28.     6.0
  29.     rectfill
  30.  
  31.     -3.0
  32.     .5 height mul 10 sub
  33.     6.0 -35.0
  34.     rectfill
  35.  
  36.     -3.0
  37.     -.5 height mul 10 add
  38.     6.0
  39.     35.0
  40.     rectfill
  41.     stroke
  42.  
  43.  
  44.     gsave
  45.     1 hasColor eq                         % minute hand
  46.       { .667 1 1 setrgbcolor }
  47.       { .667 setgray } ifelse
  48.     6.0 mins mul 180 sub rotate
  49.     2.0 setlinewidth
  50.     -2.0 0.0 moveto
  51.     -2.0 .4 height mul lineto
  52.     2.0 .4 height mul lineto
  53.     2.0 0 lineto
  54.     stroke
  55.     grestore
  56.  
  57.     0.0 setlinewidth
  58.  
  59.     gsave
  60.     1 hasColor eq                         % hour hand
  61.       { 0.0 0.0 .333 setrgbcolor }
  62.       { 0.0 setgray } ifelse
  63.     mins 60.0 div hours add 30.0 mul 180 add rotate
  64.     -2.0 0.0 4.0 .25 height mul rectfill
  65.     grestore
  66.     stroke
  67. endps
  68.  
  69. defineps drawSecond(int seconds; int width; int height; int hasColor)
  70.     width 2 div 12 add
  71.     height 2 div 12 add
  72.     translate
  73.  
  74.     0.0 setgray
  75.     6.0 seconds mul 180 sub rotate
  76.     0.0 setlinewidth
  77.     0.0 0.0 moveto
  78.     0.0 .45 height mul lineto
  79.     stroke
  80.  
  81.     0.0 .45 height mul 4.0 0.0 360.0 arc
  82.     stroke
  83.  
  84.     1.0 setgray
  85.     0.0 .45 height mul 2.0 0.0 360.0 arc
  86.     fill
  87.     stroke
  88.     -6.0 seconds mul 180 add rotate
  89. endps
  90.